export const ADD_TODO = 'ADD_TODO'
export const TOGGLE_TODO = 'TOGGLE_TODO'
export const SET_VISIBILITY_FILTER = 'SET_VISIBILITY_FILTER'
export const DEL_TODO = 'DEL_TODO'


export const VisibilityFilters = {
    SHOW_ALL:'SHOW_ALL',
    SHOW_COMPLETED:'SHOW_COMPLETED',
    SHOW_ACTIVE:'SHOW_ACTIVE',
}

/**
 * action 创建函数
 * 这些action函数就是Action Creator
 */

export const addTodo = (text)=>(
    {
        type:ADD_TODO,
        text
    }
)

export const toggleTodo = (index)=>(
    {
        type:TOGGLE_TODO,
        index
    }
)

export const setVisibilityFilter = (filter)=>(
    {
        type:SET_VISIBILITY_FILTER,
        filter
    }
)

export const delTodo = (index)=>(
    {
        type:DEL_TODO,
        index
    }
)